package com.matt.foundation.vo;

import com.matt.foundation.utils.DateUtil;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/8
 * *******************************
 */
@Data
public class ChildrenCourseItemVo {
    private String childrenCourseItemId;

    private String planId;

    private String courseTitle;

    private String courseDate;

    private String week;

    private String status;

    public static ChildrenCourseItemVo of(Object[] objects) {
        ChildrenCourseItemVo vo = new ChildrenCourseItemVo();
        vo.setChildrenCourseItemId(objects[0] == null ? "" : objects[0].toString());
        vo.setCourseTitle(objects[1] == null ? "" : objects[1].toString());
        if (Objects.nonNull(objects[2])){
            Date date = (Date) objects[2];
            vo.setCourseDate(DateUtil.millisToDateTime(date.getTime(), "MM-dd"));
        }
        vo.setWeek(objects[3] == null ? "" : objects[3].toString());
        vo.setStatus(objects[4] == null ? "" : objects[4].toString());
        vo.setPlanId(objects[5] == null ? "" : objects[5].toString());
        return vo;
    }
}
